﻿@model Frame.Models.Main
@{
    if (Tools.SessionKey.CheckKey() != null)
    {
        Response.Redirect("/Frame/Main/", true);
    }
    else
    {
        ViewBag.Title = "HAISHAN Infomation Platform";

        ViewBag.jQuery = true;

        ViewBag.Css = "/Content/Frame/Login.css";

        Layout = "~/Views/_Template.cshtml";
        
<form id="login" method="post" action=""> 

    <h1><strong>新海山信息平台</strong></h1>
    @*<p class="register"><a href="#">注册新用户</a></p>*@
    
    <div>
    	<label for="login_username">用户名</label> 
    	<input type="text" name="username" id="login_username" class="field required" title="请输入你的用户名" value="Administrator" />
    </div>			

    <div>
    	<label for="login_password">密码</label>
    	<input type="password" name="password" id="login_password" class="field required" title="请输入你的密码" value="Administratora1b2c3d4" />
    </div>			

@{
        if (HttpContext.Current.Application["ValidateCode_" + Request.UserHostAddress] != null)
        {
    <div>
    	<label for="login_validate" style="vertical-align:middle;">验证码</label>
        <img src="/Frame/Validate/" alt="验证码" style="vertical-align:middle;" />
    	<input type="text" name="validate" id="login_validate" class="field required" title="请输入左边的验证码" value="" style="vertical-align:middle;width:133px;" />
    </div>	
        }
}		  
    			
    <div class="submit">
        <button type="submit">登陆</button>   
@{
        if (ViewBag.validate != null)
        {
        <label style="margin-left:10px;color:Red;">验证码错误！</label> 
        }
        else
        {
            if (Request.Form["username"] != null && Request.Form["password"] != null)
            {  
        <label style="margin-left:10px;color:Red;">用户名或者密码错误！</label> 
            }
        }
}      
    </div>

    <p class="IE6">当前浏览器使用本平台不支持的IE6或更低版本的IE内核。<br />建议使用 Chrome、Opera、FireFox 10+、Safari 5.0+、IE 7.0+ 浏览本平台。</p>
    <p class="back">建议使用 Chrome、Opera、FireFox 10+、Safari 5.0+、IE 7.0+ 浏览本平台。</p>
  
</form>	  
<script type="text/javascript">

        window.SetFormMarginTop = function () {
            var MainHeight = ($(window).height() - $("#login").outerHeight(true)) / 2 - 40;
            $("body").css("padding-top", MainHeight + "px");
        }

        $(window).resize(function () {
            window.SetFormMarginTop();
        });

        window.SetFormMarginTop();

</script>   
    }
}
